*** Replication Do-File for BJPS Paper 'A New Dilemma of Social Democracy?' (19/09/23) - All Tables and Figures in Main Text and Supplementary Appendix Bar Figures 1, 2, and Appendix 4 and 24 (see other do-files).

*** Pre-Clean Version

***********************************************************************************

version 14
clear all
set more off, perm
set scrollbufsize 300000
set maxvar 32767

use "C:\Users\Zack.Grant\Dropbox (Nuffield College)\PROJECTS\IDENTITYPOL-GB\New Dilemma of Social Democracy Paper\BJPS Replication Files\NewSocDemDilemma_C_postclean.dta" //* Merged, cleaned and reduced version of Wave 10 BES Internet Panel


*** See 'NewSocDemDilemma_C_preclean' for information on coding and variable construction.


*** ANALYSIS AND RESULTS - MAIN TEXT

*** Vote Totals Mentioned First Page (i.e. gap in Labour Voting in 2019 between White WC and Non-White WC)

gen raceclass =. //* Categorical var distinguishing between white WC and non-white WC (based on occupation)
label define raceclass 1 "White WC" 2 "Non-White WC" 3 "Other White" 4 "Other Non-Whites", replace
label values raceclass raceclass

replace raceclass = 1 if objectiveclassW19 == 6 & ethnicityW19 == 1 //* WC Occupation + White
replace raceclass = 2 if objectiveclassW19 == 6 & ethnicityW19 == 2 //* WC Occupation + Non-White/Mixed
replace raceclass = 3 if raceclass ==. & ethnicityW19 == 1 & objectiveclassW19 != .  //* All Non-WC Whites
replace raceclass = 4 if raceclass ==. & ethnicityW19 == 2 & objectiveclassW19 != .  //* All Non-WC Non-Whites/Mixed

svyset [pweight= wt_new_W19_result], psu(id)

svy: tab voteLabW19 raceclass                                                               if ageW19 !=. & p_housingW19 !=. & p_edlevelW19 !=. & p_gross_householdW19 != ., col   //* WWC = 29%  ; Non-White WC = 58% ;  W not WC = 32%;  BME not WC = 60%
svy: reg voteLabW19 i.raceclass                                                              if ageW19 !=. & p_housingW19 !=. & p_edlevelW19 !=. & p_gross_householdW19 != .        //* 30% point gap (White WC v Non-White WC)
svy: reg voteLabW19 i.raceclass ageW19 i.p_housingW19 i.p_edlevelW19 i.p_gross_householdW19  if ageW19 !=. & p_housingW19 !=. & p_edlevelW19 !=. & p_gross_householdW19 != .        //* 18% point gap (White WC v Non-White WC)


************************************************

*** TABLE 1 ('The Impact of Evaluations of Labour's Black and Asian Representation on Evaluations of Labour's Working Class Representation, Interacted with Respondent Class-Ethnicity Group')

svyset [pweight= wt_new_W10], psu(id)	
						
* Model A *		(Restrict sample to those with non-missing values on later controls, but results the same if use full sample.)
svy: reg labLookAfterWCW10 c.labLookAfterBAW10##ib1.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10   if ethnocentrismw11 !=. & lr_scaleW10_W12 !=. & al_scaleW10_W12 !=. & labIDstrengthW10 !=. 

* Model B *		
svy: reg labLookAfterWCW10 c.labLookAfterBAW10##ib1.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10 ethnocentrismw11  if lr_scaleW10_W12 !=. & al_scaleW10_W12 !=. & labIDstrengthW10 !=. 

* Model C *		
svy: reg labLookAfterWCW10 c.labLookAfterBAW10##ib1.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10 ethnocentrismw11 lr_scaleW10_W12 al_scaleW10_W12 i.labIDstrengthW10 


*** FIGURE 3
margins, at(labLookAfterBAW10=(0(1)3) ClassGroup_W10=(1) agegrpW10=(3) female=(0) UKcountryW10=(1) labIDstrengthW10=(0)) atmeans saving(file1, replace) 
margins, at(labLookAfterBAW10=(0(1)3) ClassGroup_W10=(2) agegrpW10=(3) female=(0) UKcountryW10=(1) labIDstrengthW10=(0)) atmeans saving(file2, replace) 
margins, at(labLookAfterBAW10=(0(1)3) ClassGroup_W10=(3) agegrpW10=(3) female=(0) UKcountryW10=(1) labIDstrengthW10=(0)) atmeans saving(file3, replace) 

combomarginsplot file1 file2 file3, labels("White Working Class" "White Graduates" "Ethnic Minorities") ///
										title("{bf: Model D: + Strength Labour Partisanship Control}", size(medsmall) color(black)) ///
										addplot(hist labLookAfterBAW10, ///
                                        blcolor(gs2) fcolor(%20) lc(gs2%10) color(gs2) ///
			                            percent  ///
			                            yaxis(2)   ////
			                            yscale(alt axis(2)) ///
										ytitle("{bf: Distribution of Evaluations of}" "{bf: Labour's Black/Asian Representation}", axis(2) size(small) orientation(rvertical)) ///
			                            ylabel(0 "0%" 10 "10%" 20 "20%" 30 "30%" 40 "40%" 50 "50%", ///
		                             	labcolor() axis(2) tlcolor(black) tlwidth(thin) labsize(vsmall) angle(0) nogrid) ///
			                            ytitle("{bf: Predicted Evaluation}" "{bf: of Labour's Working}" "{bf: Class Representation}" `"{bf:(0-3)}"', orientation(horizontal)) ///
										xtitle("{bf: Evaluation of Labour's Black/Asian Representation (0-3)}")) ///
										xlabel(0 "0" 1 "1" 2 "2" 3 "3", labsize(small)) ///
										ylabel(0 "0" .5 ".5" 1 "1" 1.5 "1.5" 2 "2" 2.5 "2.5", labsize(small) angle(0) nogrid)  ///
                                        graphregion(color(white)) bgcolor(white) ///
										plot1opts(lcolor(red) mcolor(red)) plot2opts(lcolor(midblue) mcolor(midblue)) plot3opts(lcolor(black) mcolor(black)) ///
										ci1opt(recast(rarea) color(red%66) fintensity(50)) ci2opt(recast(rarea) color(midblue%66) fintensity(50)) ci3opt(color(black) fintensity(0))
	
*****************************************************	
	
*** TABLE 2 ('The Impact of Evaluations of Labour's Black and Asian, Middle Class, and Working Class Representation on Support for Labour, by Respondent Class-Ethnicity Group')

svyset [pweight= wt_new_W10], psu(id)

* Model A (Restrict sample to those with non-missing values on later controls, but results the same if use full sample.)
svy:  logit  voteLabW10 c.labLookAfterBAW10##ib1.ClassGroup_W10 c.labLookAfterMCW10##ib1.ClassGroup_W10 c.labLookAfterWCW10##ib1.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10  if ethnocentrismw11 !=.& lr_scaleW10_W12 !=. & al_scaleW10_W12 !=.  

* Model B
svy:  logit  voteLabW10 c.labLookAfterBAW10##ib1.ClassGroup_W10 c.labLookAfterMCW10##ib1.ClassGroup_W10 c.labLookAfterWCW10##ib1.ClassGroup_W10 i.agegrpW10  female i.UKcountryW10 ethnocentrismw11 if lr_scaleW10_W12 !=. & al_scaleW10_W12 !=.

* Model C
svy:  logit  voteLabW10 c.labLookAfterBAW10##ib1.ClassGroup_W10 c.labLookAfterMCW10##ib1.ClassGroup_W10 c.labLookAfterWCW10##ib1.ClassGroup_W10 i.agegrpW10  female i.UKcountryW10 ethnocentrismw11 lr_scaleW10_W12 al_scaleW10_W12 


*** FIGURE 4

* Figure 4a										
margins, at(labLookAfterWCW10=(0(1)3) ClassGroup_W10=(1) agegrpW10=(3) female=(0) UKcountryW10=(1)) atmeans saving(file1, replace) 
margins, at(labLookAfterWCW10=(0(1)3) ClassGroup_W10=(2) agegrpW10=(3) female=(0) UKcountryW10=(1)) atmeans saving(file2, replace) 
margins, at(labLookAfterWCW10=(0(1)3) ClassGroup_W10=(3) agegrpW10=(3) female=(0) UKcountryW10=(1)) atmeans saving(file3, replace) 

combomarginsplot file1 file2 file3, labels("White Working Class" "White Graduates" "Ethnic Minorities") ///
										title("{bf: a: Working Class Representation}", size(medsmall) color(black)) ///
										addplot(hist labLookAfterWCW10, ///
                                        blcolor(gs2) fcolor(%20) lc(gs2%10) color(gs2) ///
			                            percent  ///
			                            yaxis(2)   ////
			                            yscale(alt axis(2)) ///
										ytitle("{bf: Distribution of Evaluations of}" "{bf: Labour's Working Class Representation}", axis(2) size(small) orientation(rvertical)) ///
			                            ylabel(0 "0%" 10 "10%" 20 "20%" 30 "30%" 40 "40%" 50 "50%", ///
		                             	labcolor() axis(2) tlcolor(black) tlwidth(thin) labsize(vsmall) angle(0) nogrid) ///
			                            ytitle("{bf: Predicted}" "{bf: Probability}" "{bf: of Labour}" "{bf: Vote Intention}" "{bf:(0-1)}", orientation(horizontal) size(small)) ///
										xtitle("{bf: Evaluation of Labour's Working Class Representation (0-3)}")) ///
										xlabel(0 "0" 1 "1" 2 "2" 3 "3", labsize(small)) ///
										ylabel(0 "0" 0.1 ".1" 0.2 ".2" 0.3 ".3" 0.4 ".4" 0.5 ".5" 0.6 ".6" 0.7 ".7" 0.8 ".8", labsize(small) angle(0) nogrid)  ///
                                        graphregion(color(white)) bgcolor(white) ///
										plot1opts(lcolor(red) mcolor(red)) plot2opts(lcolor(midblue) mcolor(midblue)) plot3opts(lcolor(black) mcolor(black)) ///
										ci1opt(recast(rarea) color(red%66) fintensity(50)) ci2opt(recast(rarea) color(midblue%66) fintensity(50)) ci3opt(color(black) fintensity(0))


* Figure 4b																				
margins, at(labLookAfterBAW10=(0(1)3) ClassGroup_W10=(1) agegrpW10=(3) female=(0) UKcountryW10=(1)) atmeans saving(file1, replace) 
margins, at(labLookAfterBAW10=(0(1)3) ClassGroup_W10=(2) agegrpW10=(3) female=(0) UKcountryW10=(1)) atmeans saving(file2, replace) 
margins, at(labLookAfterBAW10=(0(1)3) ClassGroup_W10=(3) agegrpW10=(3) female=(0) UKcountryW10=(1)) atmeans saving(file3, replace) 

combomarginsplot file1 file2 file3, labels("White Working Class" "White Graduates" "Ethnic Minorities") ///
										title("{bf: b: Black & Asian Representation}", size(medsmall) color(black)) ///
										addplot(hist labLookAfterBAW10, ///
                                        blcolor(gs2) fcolor(%20) lc(gs2%10) color(gs2) ///
			                            percent  ///
			                            yaxis(2)   ////
			                            yscale(alt axis(2)) ///
										ytitle("{bf: Distribution of Evaluations of}" "{bf: Labour's Black/Asian Representation}", axis(2) size(small) orientation(rvertical)) ///
			                            ylabel(0 "0%" 10 "10%" 20 "20%" 30 "30%" 40 "40%" 50 "50%", ///
		                             	labcolor() axis(2) tlcolor(black) tlwidth(thin) labsize(vsmall) angle(0) nogrid) ///
			                            ytitle("{bf: Predicted}" "{bf: Probability}" "{bf: of Labour}" "{bf: Vote Intention}" "{bf:(0-1)}", orientation(horizontal) size(small)) ///
										xtitle("{bf: Evaluation of Labour's Black/Asian Representation (0-3)}")) ///
										xlabel(0 "0" 1 "1" 2 "2" 3 "3", labsize(small)) ///
										ylabel(0 "0" 0.1 ".1" 0.2 ".2" 0.3 ".3" 0.4 ".4" 0.5 ".5" 0.6 ".6" 0.7 ".7" 0.8 ".8", labsize(small) angle(0) nogrid)  ///
                                        graphregion(color(white)) bgcolor(white) ///
										plot1opts(lcolor(red) mcolor(red)) plot2opts(lcolor(midblue) mcolor(midblue)) plot3opts(lcolor(black) mcolor(black)) ///
										ci1opt(recast(rarea) color(red%66) fintensity(50)) ci2opt(recast(rarea) color(midblue%66) fintensity(50)) ci3opt(color(black) fintensity(0))												
										
* Figure 4c																					
margins, at(labLookAfterMCW10=(0(1)3) ClassGroup_W10=(1) agegrpW10=(3) female=(0) UKcountryW10=(1)) atmeans saving(file1, replace) 
margins, at(labLookAfterMCW10=(0(1)3) ClassGroup_W10=(2) agegrpW10=(3) female=(0) UKcountryW10=(1)) atmeans saving(file2, replace) 
margins, at(labLookAfterMCW10=(0(1)3) ClassGroup_W10=(3) agegrpW10=(3) female=(0) UKcountryW10=(1)) atmeans saving(file3, replace) 

combomarginsplot file1 file2 file3, labels("White Working Class" "White Graduates" "Ethnic Minorities") ///
										title("{bf: c: Middle Class Representation}", size(medsmall) color(black)) ///
										addplot(hist labLookAfterMCW10, ///
                                        blcolor(gs2) fcolor(%20) lc(gs2%10) color(gs2) ///
			                            percent  ///
			                            yaxis(2)   ////
			                            yscale(alt axis(2)) ///
										ytitle("{bf: Distribution of Evaluations of}" "{bf: Labour's Middle Class Representation}", axis(2) size(small) orientation(rvertical)) ///
			                            ylabel(0 "0%" 10 "10%" 20 "20%" 30 "30%" 40 "40%" 50 "50%", ///
		                             	labcolor() axis(2) tlcolor(black) tlwidth(thin) labsize(vsmall) angle(0) nogrid) ///
			                            ytitle("{bf: Predicted}" "{bf: Probability}" "{bf: of Labour}" "{bf: Vote Intention}" "{bf:(0-1)}", orientation(horizontal) size(small)) ///
										xtitle("{bf: Evaluation of Labour's Middle Class Representation (0-3)}")) ///
										xlabel(0 "0" 1 "1" 2 "2" 3 "3", labsize(small)) ///
										ylabel(0 "0" 0.1 ".1" 0.2 ".2" 0.3 ".3" 0.4 ".4" 0.5 ".5" 0.6 ".6" 0.7 ".7" 0.8 ".8", labsize(small) angle(0) nogrid)  ///
                                        graphregion(color(white)) bgcolor(white) ///
										plot1opts(lcolor(red) mcolor(red)) plot2opts(lcolor(midblue) mcolor(midblue)) plot3opts(lcolor(black) mcolor(black)) ///
										ci1opt(recast(rarea) color(red%66) fintensity(50)) ci2opt(recast(rarea) color(midblue%66) fintensity(50)) ci3opt(color(black) fintensity(0))

					
										
*****************************************************	

*** TABLE 3 ('The Impact of Evaluations of Labour's Relative Representation of Working Class and Black and Asian People on Support for Labour, by Respondent Class-Ethnicity Group')

* Model A 
svyset [pweight= wt_new_W10], psu(id)
svy: logit voteLabW10 c.labLookAfterBAWvWCW10##i.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10 if ethnocentrismw11 !=. &  lr_scaleW10_W12 !=. & al_scaleW10_W12 !=. 

* Model B
svyset [pweight= wt_new_W10], psu(id)
svy: logit voteLabW10 c.labLookAfterBAWvWCW10##i.ClassGroup_W10 i.agegrpW10  female i.UKcountryW10 ethnocentrismw11 lr_scaleW10_W12 al_scaleW10_W12  

* Model C
svyset [pweight= wt_new_W19_result], psu(id)
svy: logit voteLabW19 c.labLookAfterBAWvWCW19##i.ClassGroup_W19 i.agegrpW19 female i.UKcountryW19 

* Model D
svyset [pweight= wt_new_W13W19], psu(id)
svy: logit voteLabW19 c.labLookAfterBAWvWCW19##i.ClassGroup_W19 i.agegrpW19  female i.UKcountryW19  ethnocentrismw11

* Model E
svyset [pweight= wt_new_W13W19], psu(id)
svy: logit voteLabW19 c.labLookAfterBAWvWCW19##i.ClassGroup_W19 i.agegrpW19  female i.UKcountryW19 voteLabW13  

* Model F
svyset [pweight= wt_new_W13W19], psu(id)
svy: logit voteLabW19 c.labLookAfterBAWvWCW19##i.ClassGroup_W19 i.agegrpW19  female i.UKcountryW19 voteLabW13 ethnocentrismw11


*** FIGURE 5

margins, at(labLookAfterBAWvWCW19=(-3(1)3) ClassGroup_W19=(1) agegrp=(3) female=(0) UKcountryW19=(1) voteLabW13=(1)) atmeans saving(file1, replace) 
margins, at(labLookAfterBAWvWCW19=(-3(1)3) ClassGroup_W19=(2) agegrp=(3) female=(0) UKcountryW19=(1) voteLabW13=(1)) atmeans saving(file2, replace) 
margins, at(labLookAfterBAWvWCW19=(-2(1)3) ClassGroup_W19=(3) agegrp=(3) female=(0) UKcountryW19=(1) voteLabW13=(1)) atmeans saving(file3, replace) 


* Plot below was edited in Graph Editor slightly to get the appearance of the axes right, but you get the idea.
combomarginsplot file1 file2 file3, labels("White Working Class" "White Graduates" "Ethnic Minorities") ///
										title("") ///
										addplot(hist labLookAfterBAWvWCW19, ///
                                        blcolor(gs2) fcolor(%20) lc(gs2%10) color(gs2) ///
			                            percent  ///
			                            yaxis(2)   ////
			                            yscale(alt axis(2)) ///
										ytitle("{bf: Distribution of Evaluations of}" "{bf: Labour's Representation Bias}", axis(2) size(small) orientation(rvertical)) ///
			                            ylabel(0 "0%" 10 "10%" 20 "20%" 30 "30%" 40 "40%" 50 "50%", ///
		                             	labcolor() axis(2) tlcolor(black) tlwidth(thin) labsize(vsmall) angle(0) nogrid) ///
			                            ytitle("{bf: Predicted}" "{bf: Probability}" "{bf: of Loyalty}" "{bf: to Labour,}" "{bf: 2017 - 2019}" "{bf:(0-1)}", orientation(horizontal) size(small)) ///
										xtitle("{bf: Belief about Who Labour Represents Closer: the Working Class or Blacks/Asians}")) ///
										xlabel(-3 -2 -1 0 1 2 3, labsize(small)) ///
										ylabel(0 "0" 0.1 ".1" 0.2 ".2" 0.3 ".3" 0.4 ".4" 0.5 ".5" 0.6 ".6" 0.7 ".7" 0.8 ".8" 0.9 ".9" 1 "1", labsize(small) angle(0) nogrid)  ///
                                        graphregion(color(white)) bgcolor(white) ///
										plot1opts(lcolor(red) mcolor(red)) plot2opts(lcolor(midblue) mcolor(midblue)) plot3opts(lcolor(black) mcolor(black)) ///
										ci1opt(recast(rarea) color(red%66) fintensity(50)) ci2opt(recast(rarea) color(midblue%66) fintensity(50)) ci3opt(color(black) fintensity(0))
										
						
						
						
*******************************************************************************************************************************************


*** SUPPLEMENTARY APPENDIX					


***************************************************

*** APPENDIX 1

* Recode order for purpose of graph
recode ClassGroup_W10 (1 = 4 "White Working Class") (2 = 3 "White Graduates") (3 = 2 "Ethnic Minorities") (4 = 1 "Other Whites") (else=.), gen(classgroupW10)

ssc install vioplot

* Figure A1a
vioplot lr_scaleW10_W12  [aweight=wt_new_W10], horizontal over(classgroupW10) ///
title("{bf: a - Left-Right Economic Value Scale Scores by Class-Ethnicity Group}", span size(small) col(black))  ///
ylab(1 "{bf:Other Whites}" 2 "{bf:Ethnic Minorities}" 3 "{bf:White Graduates}" 4 "{bf: White Working Class}" , labsize(vsmall)) ///
xlab(0 "Most Left" 1 "1" 2 "2" 3 "3" 4 "4" 5 "5" 6 "6" 7 "7" 8 "8" 9 "9" 10 "Most Right", labsize(vsmall)) ///
xtitle("{bf: Left-Right Economic Value Score (0-10)}", orient(horizontal) size(vsmall))  ///
graphregion(color(white)) 

* Figure A1b
vioplot al_scaleW10_W12  [aweight=wt_new_W10], horizontal over(classgroupW10) ///
title("{bf: b - Liberal-Authoritarian Social Value Scale Scores by Class-Ethnicity Group}", span size(small) col(black))  ///
ylab(1 "{bf:Other Whites}" 2 "{bf:Ethnic Minorities}" 3 "{bf:White Graduates}" 4 "{bf: White Working Class}" , labsize(vsmall)) ///
xlab(0 "Most Lib." 1 "1" 2 "2" 3 "3" 4 "4" 5 "5" 6 "6" 7 "7" 8 "8" 9 "9" 10 "Most Auth.", labsize(vsmall)) ///
xtitle("{bf: Liberal-Authoritarian Social Value Score (0-10)}", orient(horizontal) size(vsmall)) ///
graphregion(color(white)) 


* Figure A1c
vioplot ethnocentrismw11 [aweight=wt_new_W11], horizontal over(classgroupW10) ///
title("{bf: c - White Ethnocentrism Scale Scores by Class-Ethnicity Group}", span size(small) col(black))  ///
ylab(1 "{bf:Other Whites}" 2 "{bf:Ethnic Minorities}" 3 "{bf:White Graduates}" 4 "{bf: White Working Class}" , labsize(vsmall)) ///
xlab(-10 "Non-White Ethnocentric"  -5 "-5" 0 "Non-Ethnocentric" 5 "5"  10 "White Ethnocentric.", labsize(vsmall)) ///
xtitle("{bf: White Ethnocentrism Scale Score (-10 to 10)}", orient(horizontal) size(vsmall)) ///
graphregion(color(white)) 


* Figure A1d
vioplot immigSelfW10 [aweight=wt_new_W10], horizontal over(classgroupW10) ///
title("{bf: c - Immigration Preferences by Class-Ethnicity Group}", span size(small) col(black))  ///
ylab(1 "{bf:Other Whites}" 2 "{bf:Ethnic Minorities}" 3 "{bf:White Graduates}" 4 "{bf: White Working Class}" , labsize(vsmall)) ///
xlab(0 "Allow Many Fewer" 1 "1" 2 "2" 3 "3" 4 "4" 5 "5" 6 "6" 7 "7" 8 "8" 9 "9" 10 "Allow Many More", labsize(vsmall)) ///
xtitle("{bf: Immigration Preference Scale (0-10)}", orient(horizontal) size(vsmall))  ///
graphregion(color(white)) 


***************************************************

*** APPENDIX 2

* Figure A2a

* Recode order for purpose of graph
recode labLookAfterWCW10 (3 = 0 "Very Closely") (2 = 1 "Fairly Closely") (1 = 2 "Not Very Closely") (0 = 3 "Not at all Closely") (else=.), gen(LabourWC_W10)
recode labLookAfterBAW10 (3 = 0 "Very Closely") (2 = 1 "Fairly Closely") (1 = 2 "Not Very Closely") (0 = 3 "Not at all Closely") (else=.), gen(LabourBME_W10)
recode labLookAfterMCW10 (3 = 0 "Very Closely") (2 = 1 "Fairly Closely") (1 = 2 "Not Very Closely") (0 = 3 "Not at all Closely") (else=.), gen(LabourMC_W10)


tabplot LabourWC_W10 ClassGroup_W10 [aw=wt_new_W10], percent(ClassGroup_W10) showval  graphregion(color(white))  ///
subtitle('How closely do you think Labour Party looks after the interests of {bf:working class} people?', ///
size(vsmall)) xtitle("") ytitle("{bf: Working Class}" "{bf: Representation}", size(small)) bfcolor(none) ///
ylab(, labsize(vsmall)) ///
xlab(4 "{bf:Other Whites}" 3 "{bf:Ethnic Minorities}" 2 "{bf:White Graduates}" 1 "{bf: White Working Class}" , labsize(vsmall)) ///
saving(WC, replace)

tabplot LabourBME_W10 ClassGroup_W10 [aw=wt_new_W10], percent(ClassGroup_W10) showval  graphregion(color(white))  ///
subtitle('How closely do you think Labour Party looks after the interests of {bf:black and Asian} people?', ///
size(vsmall)) xtitle("") ytitle("{bf: Black and Asian}" "{bf: Representation}", size(small)) bfcolor(none) ///
ylab(, labsize(vsmall)) ///
xlab(4 "{bf:Other Whites}" 3 "{bf:Ethnic Minorities}" 2 "{bf:White Graduates}" 1 "{bf: White Working Class}" , labsize(vsmall)) ///
saving(BME, replace)


tabplot LabourMC_W10 ClassGroup_W10 [aw=wt_new_W10], percent(ClassGroup_W10) showval  graphregion(color(white))  ///
subtitle('How closely do you think Labour Party looks after the interests of {bf:middle class} people?', ///
size(vsmall)) xtitle("") ytitle("{bf: Middle Class}" "{bf: Representation}", size(small)) bfcolor(none) ///
ylab(, labsize(vsmall)) ///
xlab(4 "{bf:Other Whites}" 3 "{bf:Ethnic Minorities}" 2 "{bf:White Graduates}" 1 "{bf: White Working Class}" , labsize(vsmall)) ///
saving(MC, replace)


gr combine WC.gph BME.gph MC.gph, col(1) graphregion(color(white)) ///
title("{bf: a - Perceptions of Labour Representation of Different Groups (November-December 2016)}", span size(small) col(black)) 

	 
* Figure A2b

* Recode order for purpose of graph
recode ClassGroup_W19 (1 = 4 "White Working Class") (2 = 3 "White Graduates") (3 = 2 "Ethnic Minorities") (4 = 1 "Other Whites") (else=.), gen(classgroupW19)

* Recode order for purpose of graph
recode labLookAfterWCW19 (3 = 0 "Very Closely") (2 = 1 "Fairly Closely") (1 = 2 "Not Very Closely") (0 = 3 "Not at all Closely") (else=.), gen(LabourWC_W19)
recode labLookAfterBAW19 (3 = 0 "Very Closely") (2 = 1 "Fairly Closely") (1 = 2 "Not Very Closely") (0 = 3 "Not at all Closely") (else=.), gen(LabourBME_W19)
recode labLookAfterMCW19 (3 = 0 "Very Closely") (2 = 1 "Fairly Closely") (1 = 2 "Not Very Closely") (0 = 3 "Not at all Closely") (else=.), gen(LabourMC_W19)


tabplot LabourWC_W19 ClassGroup_W19 [aw=wt_new_W19_result], percent(ClassGroup_W19) showval  graphregion(color(white))  ///
subtitle('How closely do you think Labour Party looks after the interests of {bf:working class} people?', ///
size(vsmall)) xtitle("") ytitle("{bf: Working Class}" "{bf: Representation}", size(small)) bfcolor(none) ///
ylab(, labsize(vsmall)) ///
xlab(4 "{bf:Other Whites}" 3 "{bf:Ethnic Minorities}" 2 "{bf:White Graduates}" 1 "{bf: White Working Class}" , labsize(vsmall)) ///
saving(WC, replace)

tabplot LabourBME_W19 ClassGroup_W19 [aw=wt_new_W19_result], percent(ClassGroup_W19) showval  graphregion(color(white))  ///
subtitle('How closely do you think Labour Party looks after the interests of {bf:black and Asian} people?', ///
size(vsmall)) xtitle("") ytitle("{bf: Black and Asian}" "{bf: Representation}", size(small)) bfcolor(none) ///
ylab(, labsize(vsmall)) ///
xlab(4 "{bf:Other Whites}" 3 "{bf:Ethnic Minorities}" 2 "{bf:White Graduates}" 1 "{bf: White Working Class}" , labsize(vsmall)) ///
saving(BME, replace)


tabplot LabourMC_W19 ClassGroup_W19 [aw=wt_new_W19_result], percent(ClassGroup_W19) showval  graphregion(color(white))  ///
subtitle('How closely do you think Labour Party looks after the interests of {bf:middle class} people?', ///
size(vsmall)) xtitle("") ytitle("{bf: Middle Class}" "{bf: Representation}", size(small)) bfcolor(none) ///
ylab(, labsize(vsmall)) ///
xlab(4 "{bf:Other Whites}" 3 "{bf:Ethnic Minorities}" 2 "{bf:White Graduates}" 1 "{bf: White Working Class}" , labsize(vsmall)) ///
saving(MC, replace)


gr combine WC.gph BME.gph MC.gph, col(1) graphregion(color(white)) ///
title("{bf: b - Perceptions of Labour Representation of Different Groups (December 2019)}", span size(small) col(black)) 


* Figure A2c

* Recode order for purpose of graph
recode labLookAfterWCW21 (3 = 0 "Very Closely") (2 = 1 "Fairly Closely") (1 = 2 "Not Very Closely") (0 = 3 "Not at all Closely") (else=.), gen(LabourWC_W21)
recode labLookAfterBAW21 (3 = 0 "Very Closely") (2 = 1 "Fairly Closely") (1 = 2 "Not Very Closely") (0 = 3 "Not at all Closely") (else=.), gen(LabourBME_W21)
recode labLookAfterMCW21 (3 = 0 "Very Closely") (2 = 1 "Fairly Closely") (1 = 2 "Not Very Closely") (0 = 3 "Not at all Closely") (else=.), gen(LabourMC_W21)

* Recode order for purpose of graph
tabplot LabourWC_W21 ClassGroup_W21 [aw=wt_new_W21], percent(ClassGroup_W21) showval  graphregion(color(white))  ///
subtitle('How closely do you think Labour Party looks after the interests of {bf:working class} people?', ///
size(vsmall)) xtitle("") ytitle("{bf: Working Class}" "{bf: Representation}", size(small)) bfcolor(none) ///
ylab(, labsize(vsmall)) ///
xlab(4 "{bf:Other Whites}" 3 "{bf:Ethnic Minorities}" 2 "{bf:White Graduates}" 1 "{bf: White Working Class}" , labsize(vsmall)) ///
saving(WC, replace)

tabplot LabourBME_W21 ClassGroup_W21 [aw=wt_new_W21], percent(ClassGroup_W21) showval  graphregion(color(white))  ///
subtitle('How closely do you think Labour Party looks after the interests of {bf:black and Asian} people?', ///
size(vsmall)) xtitle("") ytitle("{bf: Black and Asian}" "{bf: Representation}", size(small)) bfcolor(none) ///
ylab(, labsize(vsmall)) ///
xlab(4 "{bf:Other Whites}" 3 "{bf:Ethnic Minorities}" 2 "{bf:White Graduates}" 1 "{bf: White Working Class}" , labsize(vsmall)) ///
saving(BME, replace)


tabplot LabourMC_W21 ClassGroup_W21 [aw=wt_new_W21], percent(ClassGroup_W21) showval  graphregion(color(white))  ///
subtitle('How closely do you think Labour Party looks after the interests of {bf:middle class} people?', ///
size(vsmall)) xtitle("") ytitle("{bf: Middle Class}" "{bf: Representation}", size(small)) bfcolor(none) ///
ylab(, labsize(vsmall)) ///
xlab(4 "{bf:Other Whites}" 3 "{bf:Ethnic Minorities}" 2 "{bf:White Graduates}" 1 "{bf: White Working Class}" , labsize(vsmall)) ///
saving(MC, replace)


gr combine WC.gph BME.gph MC.gph, col(1) graphregion(color(white)) ///
title("{bf: c - Perceptions of Labour Representation of Different Groups (May 2021)}", span size(small) col(black)) 

	 
	 
***************************************************

*** APPENDIX 3
	 
	
* Figure A3a

tabplot labLookAfterBAWvWCW10 ClassGroup_W10 [aw=wt_new_W10], percent(ClassGroup_W10) showval  graphregion(color(white))  ///
xtitle("") ytitle("", size(small)) bfcolor(none) ///
ylab(, labsize(vsmall)) ///
xlab(4 "{bf:Other Whites}" 3 "{bf:Ethnic Minorities}" 2 "{bf:White Graduates}" 1 "{bf: White Working Class}" , labsize(vsmall)) ///
title("{bf: a - Perceptions of Labour's Relative Representation of Working Class and Black and Asian People (November-December 2016)}", span size(small) col(black))

* Figure A3b

tabplot labLookAfterBAWvWCW19 ClassGroup_W19 [aw=wt_new_W19_result], percent(ClassGroup_W19) showval  graphregion(color(white))  ///
xtitle("") ytitle("", size(small)) bfcolor(none) ///
ylab(, labsize(vsmall)) ///
xlab(4 "{bf:Other Whites}" 3 "{bf:Ethnic Minorities}" 2 "{bf:White Graduates}" 1 "{bf: White Working Class}" , labsize(vsmall)) ///
title("{bf: b - Perceptions of Labour's Relative Representation of Working Class and Black and Asian People (December 2019)}", span size(small) col(black)) 
	 
* Figure A3c

tabplot labLookAfterBAWvWCW21 ClassGroup_W21 [aw=wt_new_W21], percent(ClassGroup_W21) showval  graphregion(color(white))  ///
xtitle("") ytitle("", size(small)) bfcolor(none) ///
ylab(, labsize(vsmall)) ///
xlab(4 "{bf:Other Whites}" 3 "{bf:Ethnic Minorities}" 2 "{bf:White Graduates}" 1 "{bf: White Working Class}" , labsize(vsmall)) ///
title("{bf: c - Perceptions of Labour's Relative Representation of Working Class and Black and Asian People (May 2021)}", span size(small) col(black)) 
	 

***************************************************

*** APPENDIX 4 (see Do-File 1)

***************************************************
	 
*** APPENDIX 5 - 'What can Ethnocentrism Predict?'


** Recode immigration scale so higher = more anti.
recode immigSelfW10 (10 = 0 "Allow Many More") (9 = 1) (8 = 2) (7 = 3) (6 = 4) (5 = 5) (4 = 6) (3 = 7) (2 = 8) (1 = 9) (0 = 10 "Allow Many Fewer"), gen (antiimmigself)

 
 * Models A-C (Ethnocentrism measure can predict 'anti-immigration' sentiment)
svyset [pweight= wt_new_W10], psu(id)
svy: reg antiimmigself             ib1.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10                        if ethnocentrismw11 !=. & lr_scaleW10_W12 !=. & al_scaleW10_W12 !=.
svy: reg antiimmigself             ib1.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10 ethnocentrismw11       if ethnocentrismw11 !=. & lr_scaleW10_W12 !=. & al_scaleW10_W12 !=.
svy: reg antiimmigself             ib1.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10 ethnocentrismw11 lr_scaleW10_W12 al_scaleW10_W12  if ethnocentrismw11 !=. & lr_scaleW10_W12 !=. & al_scaleW10_W12 !=.

 * Models D-F (Ethnocentrism measure can predict 'anti-immigration' sentiment)
svyset [pweight= wt_new_W10], psu(id)
svy: reg EUIntegrationSelfW10     ib1.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10                         if ethnocentrismw11 !=. & lr_scaleW10_W12 !=. & al_scaleW10_W12 !=. 
svy: reg EUIntegrationSelfW10     ib1.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10 ethnocentrismw11        if ethnocentrismw11 !=. & lr_scaleW10_W12 !=. & al_scaleW10_W12 !=.
svy: reg EUIntegrationSelfW10     ib1.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10 ethnocentrismw11 lr_scaleW10_W12 al_scaleW10_W12  if ethnocentrismw11 !=. & lr_scaleW10_W12 !=. & al_scaleW10_W12 !=.


***************************************************
	 
*** APPENDIX 6 - What Predicts Belief that Labour Represents the Working Class? (Table)


svyset [pweight= wt_new_W10], psu(id)

* Model A	
svy: reg labLookAfterWCW10 labLookAfterBAW10 ethnocentrismw11            i.ClassGroup_W10  i.agegrpW10 female i.UKcountryW10   if lr_scaleW10_W12 !=. & al_scaleW10_W12 !=. & labIDstrengthW10 !=.

* Model B	
svy: reg labLookAfterWCW10 c.labLookAfterBAW10##c.ethnocentrismw11       i.ClassGroup_W10  i.agegrpW10 female i.UKcountryW10   if lr_scaleW10_W12 !=. & al_scaleW10_W12 !=. & labIDstrengthW10 !=.
 
* Model C
svy: reg labLookAfterWCW10 c.labLookAfterBAW10##c.ethnocentrismw11       i.ClassGroup_W10  i.agegrpW10 female i.UKcountryW10  lr_scaleW10_W12 al_scaleW10_W12  if labIDstrengthW10 !=.
 
*Model D
svy: reg labLookAfterWCW10 c.labLookAfterBAW10##c.ethnocentrismw11       i.ClassGroup_W10  i.agegrpW10 female i.UKcountryW10  lr_scaleW10_W12 al_scaleW10_W12 i.labIDstrengthW10 


***************************************************
	 
*** APPENDIX 7 - What Predicts Belief that Labour Represents the Working Class? (MarginsPlot)

* Model B
svy: reg labLookAfterWCW10 c.labLookAfterBAW10##c.ethnocentrismw11       i.ClassGroup_W10  i.agegrpW10 female i.UKcountryW10   if lr_scaleW10_W12 !=. & al_scaleW10_W12 !=. & labIDstrengthW10 !=.

margins, at(labLookAfterBAW10=(0(1)3) ethnocentrismw11=(0)      ClassGroup_W10=(1) agegrp=(3) female=(0) UKcountryW10=(1)) atmeans saving(file1, replace) 
margins, at(labLookAfterBAW10=(0(1)3) ethnocentrismw11=(10)     ClassGroup_W10=(1) agegrp=(3) female=(0) UKcountryW10=(1)) atmeans saving(file2, replace) 

combomarginsplot file1 file2, labels("Low White Ethnocentrism" "High White Ethnocentrism")  ///
										title("{bf: Model A: Demographic Controls}", size(medsmall) color(black)) ///
										addplot(hist labLookAfterBAW10, ///
                                        blcolor(gs2) fcolor(%20) lc(gs2%10) color(gs2) ///
			                            percent  ///
			                            yaxis(2)   ////
			                            yscale(alt axis(2)) ///
										ytitle("{bf: Distribution of Evaluations of}" "{bf: Labour's Black/Asian Representation}", axis(2) size(small) orientation(rvertical)) ///
			                            ylabel(0 "0%" 10 "10%" 20 "20%" 30 "30%" 40 "40%" 50 "50%", ///
		                             	labcolor() axis(2) tlcolor(black) tlwidth(thin) labsize(vsmall) angle(0) nogrid) ///
			                            ytitle("{bf: Predicted Evaluation}" "{bf: of Labour's Working}" "{bf: Class Representation}" `"{bf:(0-3)}"', orientation(horizontal)) ///
										xtitle("{bf: Evaluation of Labour's Black/Asian Representation (0-3)}")) ///
										xlabel(0 "0" 1 "1" 2 "2" 3 "3", labsize(small)) ///
										ylabel(1 "1" 1.5 "1.5" 2 "2" 2.5 "2.5", labsize(small) angle(0) nogrid)  ///
                                        graphregion(color(white)) bgcolor(white) ///
										plot1opts(lcolor(blue) mcolor(blue)) plot2opts(lcolor(red) mcolor(red)) ///
										ci1opt(color(blue%66) fintensity(50)) ci2opt(color(red%66) fintensity(50))  ///
										ciopts(recast(rarea))		

* Model D
svy: reg labLookAfterWCW10 c.labLookAfterBAW10##c.ethnocentrismw11       i.ClassGroup_W10  i.agegrpW10 female i.UKcountryW10  lr_scaleW10_W12 al_scaleW10_W12 i.labIDstrengthW10 

margins, at(labLookAfterBAW10=(0(1)3) ethnocentrismw11=(0) ClassGroup_W10=(1) agegrp=(3) female=(0) UKcountryW10=(1) labIDstrengthW10 =(0)) atmeans saving(file1, replace) 
margins, at(labLookAfterBAW10=(0(1)3) ethnocentrismw11=(10) ClassGroup_W10=(1) agegrp=(3) female=(0) UKcountryW10=(1) labIDstrengthW10 =(0)) atmeans saving(file2, replace) 

combomarginsplot file1 file2, labels("Low White Ethnocentrism" "High White Ethnocentrism")  ///
										title("{bf: Model D: Partisan + Left/Right & Lib/Auth Value Controls}", size(medsmall) color(black)) ///
										addplot(hist labLookAfterBAW10, ///
                                        blcolor(gs2) fcolor(%20) lc(gs2%10) color(gs2) ///
			                            percent  ///
			                            yaxis(2)   ////
			                            yscale(alt axis(2)) ///
										ytitle("{bf: Distribution of Evaluations of}" "{bf: Labour's Black/Asian Representation}", axis(2) size(small) orientation(rvertical)) ///
			                            ylabel(0 "0%" 10 "10%" 20 "20%" 30 "30%" 40 "40%" 50 "50%", ///
		                             	labcolor() axis(2) tlcolor(black) tlwidth(thin) labsize(vsmall) angle(0) nogrid) ///
			                            ytitle("{bf: Predicted Evaluation}" "{bf: of Labour's Working}" "{bf: Class Representation}" `"{bf:(0-3)}"', orientation(horizontal)) ///
										xtitle("{bf: Evaluation of Labour's Black/Asian Representation (0-3)}")) ///
										xlabel(0 "0" 1 "1" 2 "2" 3 "3", labsize(small)) ///
										ylabel(1 "1" 1.5 "1.5" 2 "2" 2.5 "2.5", labsize(small) angle(0) nogrid)  ///
                                        graphregion(color(white)) bgcolor(white) ///
										plot1opts(lcolor(blue) mcolor(blue)) plot2opts(lcolor(red) mcolor(red)) ///
										ci1opt(color(blue%66) fintensity(50)) ci2opt(color(red%66) fintensity(50))  ///
										ciopts(recast(rarea))	
  
  
  
***************************************************
	 
*** APPENDIX 8 - The Impact of Ethnocentrism and Evaluations of Labour's Minority, Middle Class and Working Class Representation (Table)


svyset [pweight= wt_new_W10], psu(id)

* Model A
svy:  logit  voteLabW10  i.ClassGroup_W10    i.agegrpW10 female i.UKcountryW10      if lr_scaleW10_W12 !=. & al_scaleW10_W12 !=. & labLookAfterMCW10 !=. & labLookAfterWCW10 !=. & labLookAfterBAW10 !=. & ethnocentrismw11 !=.

* Model B
svy:  logit  voteLabW10  i.ClassGroup_W10  ethnocentrismw11   i.agegrpW10 female i.UKcountryW10      if lr_scaleW10_W12 !=. & al_scaleW10_W12 !=. & labLookAfterMCW10 !=. & labLookAfterWCW10 !=. & labLookAfterBAW10 !=.

* Model C
svy:  logit  voteLabW10  i.ClassGroup_W10   lr_scaleW10_W12 al_scaleW10_W12  i.agegrpW10 female i.UKcountryW10      if lr_scaleW10_W12 !=. & al_scaleW10_W12 !=. & labLookAfterMCW10 !=. & labLookAfterWCW10 !=. & labLookAfterBAW10 !=. & ethnocentrismw11 !=.

* Model D
svy:  logit  voteLabW10  i.ClassGroup_W10   ethnocentrismw11 lr_scaleW10_W12 al_scaleW10_W12  i.agegrpW10 female i.UKcountryW10      if lr_scaleW10_W12 !=. & al_scaleW10_W12 !=. & labLookAfterMCW10 !=. & labLookAfterWCW10 !=. & labLookAfterBAW10 !=. & ethnocentrismw11 !=.

* Model E
svy:  logit  voteLabW10  i.ClassGroup_W10   c.labLookAfterBAW10##c.ethnocentrismw11  i.agegrpW10 female i.UKcountryW10      if lr_scaleW10_W12 !=. & al_scaleW10_W12 !=. & labLookAfterMCW10 !=. & labLookAfterWCW10 !=. & labLookAfterBAW10 !=. & ethnocentrismw11 !=.

* Model F
svy:  logit  voteLabW10  i.ClassGroup_W10   c.labLookAfterBAW10##c.ethnocentrismw11 lr_scaleW10_W12 al_scaleW10_W12 i.agegrpW10 female i.UKcountryW10      if lr_scaleW10_W12 !=. & al_scaleW10_W12 !=. & labLookAfterMCW10 !=. & labLookAfterWCW10 !=. & labLookAfterBAW10 !=. & ethnocentrismw11 !=.

* Model G
svy:  logit  voteLabW10 c.labLookAfterBAW10##c.ethnocentrismw11 c.labLookAfterMCW10##c.ethnocentrismw11 c.labLookAfterWCW10##c.ethnocentrismw11 i.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10  lr_scaleW10_W12 al_scaleW10_W12 


***************************************************
	 
*** APPENDIX 9 - The Impact of Evaluations of Labour's Black & Asian Representation on Support for the Labour Party  (Marginsplot)

* Model F
svy:  logit  voteLabW10  i.ClassGroup_W10   c.labLookAfterBAW10##c.ethnocentrismw11 lr_scaleW10_W12 al_scaleW10_W12 i.agegrpW10 female i.UKcountryW10      if lr_scaleW10_W12 !=. & al_scaleW10_W12 !=. & labLookAfterMCW10 !=. & labLookAfterWCW10 !=. & labLookAfterBAW10 !=. & ethnocentrismw11 !=.
  
margins, at(labLookAfterBAW10=(0(1)3) ethnocentrismw11=(0)  ClassGroup_W10=(1) agegrp=(3) female=(0) UKcountryW10=(1)) atmeans saving(file1, replace) 
margins, at(labLookAfterBAW10=(0(1)3) ethnocentrismw11=(10) ClassGroup_W10=(1) agegrp=(3) female=(0) UKcountryW10=(1)) atmeans saving(file2, replace) 

combomarginsplot file1 file2, labels("Low White Ethnocentrism" "High White Ethnocentrism")  ///
										title("{bf: Model F: Impact of Labour's Black/Asian Representation}", size(medsmall) color(black)) ///
										addplot(hist labLookAfterBAW10, ///
                                        blcolor(gs2) fcolor(%20) lc(gs2%10) color(gs2) ///
			                            percent  ///
			                            yaxis(2)   ////
			                            yscale(alt axis(2)) ///
										ytitle("{bf: Distribution of Evaluations of}" "{bf: Labour's Black/Asian Representation}", axis(2) size(small) orientation(rvertical)) ///
			                            ylabel(0 "0%" 10 "10%" 20 "20%" 30 "30%" 40 "40%" 50 "50%", ///
		                             	labcolor() axis(2) tlcolor(black) tlwidth(thin) labsize(vsmall) angle(0) nogrid) ///
			                            ytitle("{bf: Predicted}" "{bf: Probability}" "{bf: of Labour}" "{bf: Support (0-1)}", orientation(horizontal)) ///
										xtitle("{bf: Evaluation of Labour's Black/Asian Representation (0-3)}")) ///
										xlabel(0 "0" 1 "1" 2 "2" 3 "3", labsize(small)) ///
										ylabel(0 "0" 0.1 ".1" 0.2 ".2" 0.3 ".3" 0.4 ".4" 0.5 ".5" 0.6 ".6" 0.7 ".7" 0.8 ".8", labsize(small) angle(0) nogrid)  ///
                                        graphregion(color(white)) bgcolor(white) ///
										plot1opts(lcolor(blue) mcolor(blue)) plot2opts(lcolor(red) mcolor(red)) ///
										ci1opt(color(blue%66) fintensity(50)) ci2opt(color(red%66) fintensity(50))  ///
										ciopts(recast(rarea))	
											

***************************************************
	 
*** APPENDIX 10 - The Impact of Left-Right, Libertarian-Authoritarian, and White Ethnocentrism on Support for the Labour Party (Dec 2016) (Coefsplot)

* Model F

** Standardising Vars for Graph

svy:  logit  voteLabW10  i.ClassGroup_W10   ethnocentrismw11 lr_scaleW10_W12 al_scaleW10_W12  i.agegrpW10 female i.UKcountryW10      if lr_scaleW10_W12 !=. & al_scaleW10_W12 !=. & labLookAfterMCW10 !=. & labLookAfterWCW10 !=. & labLookAfterBAW10 !=. & ethnocentrismw11 !=.
gen mod2 =e(sample)

 gen std_ethno =.
 sum ethnocentrismw11 if mod2 == 1
 replace std_ethno = (ethnocentrismw11 - r(mean)) / r(sd) if mod2 == 1

 gen std_lr =.
 sum lr_scaleW10_W12 if mod2 == 1
 replace std_lr = (lr_scaleW10_W12 - r(mean)) / r(sd) if mod2 == 1
 
 gen std_al =.
 sum al_scaleW10_W12 if mod2 == 1
 replace std_al = (al_scaleW10_W12 - r(mean)) / r(sd) if mod2 == 1
  
  
  
svy:  logit  voteLabW10  i.ClassGroup_W10   std_ethno std_lr std_al  i.agegrpW10 female i.UKcountryW10      if lr_scaleW10_W12 !=. & al_scaleW10_W12 !=. & labLookAfterMCW10 !=. & labLookAfterWCW10 !=. & labLookAfterBAW10 !=. & ethnocentrismw11 !=., or
estimate store mod1


 coefplot (mod1, label(Model A (White Working Class))), ///
          drop(_cons *.agegrpW10 female *.UKcountryW10  *ClassGroup_W10) eform ///
		  xline(1,  lcolor(black) lwidth(medthick) lpattern(dash)) xlab(0.2(0.2)1.2, nogrid) ///
		  byopts(row(1))
		  
		  
***************************************************
	 
*** APPENDIX 11 - What Predicts White Ethnocentrism in Britain?

svyset [pweight= wt_new_W10], psu(id)

* Model A
svy: reg ethnocentrismw11  ib1.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10 if lr_scaleW10_W12 !=. & al_scaleW10_W12 !=.

* Model B
svy: reg ethnocentrismw11   lr_scaleW10_W12 al_scaleW10_W12 if ClassGroup_W10 !=. & agegrpW10 !=. & female !=. & UKcountryW10 !=.

* Model C
svy: reg ethnocentrismw11  ib1.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10  lr_scaleW10_W12 al_scaleW10_W12 

  
***************************************************
	 
*** APPENDIX 12 - The Impact of Evaluations of Labour's Black and Asian Representation on Evaluations of Labour's Working Class Representation (Immigration Attitudes rather than Ethnocentrism)

svyset [pweight= wt_new_W10], psu(id)	
						
* Model A *		
svy: reg labLookAfterWCW10 c.labLookAfterBAW10##ib1.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10  if immigSelfW10 !=.	& lr_scaleW10_W12 !=. & al_scaleW10_W12 !=. & labIDstrengthW10 !=. 

* Model B *		
svy: reg labLookAfterWCW10 c.labLookAfterBAW10##ib1.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10  immigSelfW10  if lr_scaleW10_W12 !=. & al_scaleW10_W12 !=. & labIDstrengthW10 !=. 

* Model C *		
svy: reg labLookAfterWCW10 c.labLookAfterBAW10##ib1.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10  immigSelfW10 lr_scaleW10_W12 al_scaleW10_W12 i.labIDstrengthW10  


*************************************
		
*** APPENDIX 13 - The Impact of Evaluations of Labour’s Black and Asian (BME), Middle Class (MC), and Working Class (WC) Representation on Support for Labour (Immigration Attitudes rather than Ethnocentrism)

svyset [pweight= wt_new_W10], psu(id)

* Model A *
svy:  logit  voteLabW10 c.labLookAfterBAW10##ib1.ClassGroup_W10 c.labLookAfterMCW10##ib1.ClassGroup_W10 c.labLookAfterWCW10##ib1.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10  if  immigSelfW10 !=.& lr_scaleW10_W12 !=. & al_scaleW10_W12 !=.  

* Model B *
svy:  logit  voteLabW10 c.labLookAfterBAW10##ib1.ClassGroup_W10 c.labLookAfterMCW10##ib1.ClassGroup_W10 c.labLookAfterWCW10##ib1.ClassGroup_W10 i.agegrpW10  female i.UKcountryW10  immigSelfW10 if lr_scaleW10_W12 !=. & al_scaleW10_W12 !=. 

* Model C *
svy:  logit  voteLabW10 c.labLookAfterBAW10##ib1.ClassGroup_W10 c.labLookAfterMCW10##ib1.ClassGroup_W10 c.labLookAfterWCW10##ib1.ClassGroup_W10 i.agegrpW10  female i.UKcountryW10  immigSelfW10 lr_scaleW10_W12 al_scaleW10_W12 

 
 
*************************************
		
*** APPENDIX 14 - The Impact of Evaluations of Labour’s Relative Representation of Ethnic Minorities and the Working Class on Support for Labour (Immigration Attitudes rather than Ethnocentrism)

 
* Model A
svyset [pweight= wt_new_W10], psu(id)
svy: logit voteLabW10 c.labLookAfterBAWvWCW10##i.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10 if immigSelfW10 !=. &  lr_scaleW10_W12 !=. & al_scaleW10_W12 !=. 

* Model B
svyset [pweight= wt_new_W10], psu(id)
svy: logit voteLabW10 c.labLookAfterBAWvWCW10##i.ClassGroup_W10 i.agegrpW10  female i.UKcountryW10 immigSelfW10 lr_scaleW10_W12 al_scaleW10_W12  

* Model C
svyset [pweight= wt_new_W19_result], psu(id)
svy: logit voteLabW19 c.labLookAfterBAWvWCW19##i.ClassGroup_W19 i.agegrpW19 female i.UKcountryW19 

* Model D
svyset [pweight= wt_new_W13W19], psu(id)
svy: logit voteLabW19 c.labLookAfterBAWvWCW19##i.ClassGroup_W19 i.agegrpW19  female i.UKcountryW19  immigSelfW17

* Model E
svyset [pweight= wt_new_W13W19], psu(id)
svy: logit voteLabW19 c.labLookAfterBAWvWCW19##i.ClassGroup_W19 i.agegrpW19  female i.UKcountryW19 voteLabW13 

* Model F
svyset [pweight= wt_new_W13W19], psu(id)
svy: logit voteLabW19 c.labLookAfterBAWvWCW19##i.ClassGroup_W19 i.agegrpW19  female i.UKcountryW19 voteLabW13 immigSelfW17


*************************************
		
*** APPENDIX 15 - The Impact of Evaluations of Labour’s Black and Asian Representation on Evaluations of Labour’s Working Class Representation, With Additional Control for Attitudes to European Union Integration 

svyset [pweight= wt_new_W10], psu(id)

* Model A *		
svy: reg labLookAfterWCW10 c.labLookAfterBAW10##ib1.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10 EUIntegrationSelfW10  if ethnocentrismw11 !=.	& lr_scaleW10_W12 !=. & al_scaleW10_W12 !=. & labIDstrengthW10 !=. 

* Model B *		
svy: reg labLookAfterWCW10 c.labLookAfterBAW10##ib1.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10 ethnocentrismw11 EUIntegrationSelfW10 if lr_scaleW10_W12 !=. & al_scaleW10_W12 !=. & labIDstrengthW10 !=. 

* Model C *		
svy: reg labLookAfterWCW10 c.labLookAfterBAW10##ib1.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10 ethnocentrismw11 lr_scaleW10_W12 al_scaleW10_W12 EUIntegrationSelfW10 i.labIDstrengthW10 
 
 

*************************************
	
*** APPENDIX 16 - The Impact of Evaluations of Labour’s Black and Asian (BME), Middle Class (MC), and Working Class (WC) Representation on Support for Labour,  With Additional Control for Attitudes to European Union Integration  
	
svyset [pweight= wt_new_W10], psu(id)

* Model A
svy:  logit  voteLabW10 c.labLookAfterBAW10##ib1.ClassGroup_W10 c.labLookAfterMCW10##ib1.ClassGroup_W10 c.labLookAfterWCW10##ib1.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10 EUIntegrationSelfW10  if ethnocentrismw11 !=.& lr_scaleW10_W12 !=. & al_scaleW10_W12 !=.  

* Model B
svy:  logit  voteLabW10 c.labLookAfterBAW10##ib1.ClassGroup_W10 c.labLookAfterMCW10##ib1.ClassGroup_W10 c.labLookAfterWCW10##ib1.ClassGroup_W10 i.agegrpW10  female i.UKcountryW10 ethnocentrismw11 EUIntegrationSelfW10 if lr_scaleW10_W12 !=. & al_scaleW10_W12 !=.

* Model C
svy:  logit  voteLabW10 c.labLookAfterBAW10##ib1.ClassGroup_W10 c.labLookAfterMCW10##ib1.ClassGroup_W10 c.labLookAfterWCW10##ib1.ClassGroup_W10 i.agegrpW10  female i.UKcountryW10 ethnocentrismw11 lr_scaleW10_W12 al_scaleW10_W12 EUIntegrationSelfW10
 
 

*************************************

*** APPENDIX 17 - The Impact of Evaluations of Labour’s Relative Representation of Ethnic Minorities and the Working Class on Support for Labour with Additional Control for Attitudes to European Union Integration 
 
 * Model A
svyset [pweight= wt_new_W10], psu(id)
svy: logit voteLabW10 c.labLookAfterBAWvWCW10##i.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10 EUIntegrationSelfW10 if ethnocentrismw11 !=. &  lr_scaleW10_W12 !=. & al_scaleW10_W12 !=. 

* Model B
svyset [pweight= wt_new_W10], psu(id)
svy: logit voteLabW10 c.labLookAfterBAWvWCW10##i.ClassGroup_W10 i.agegrpW10  female i.UKcountryW10 EUIntegrationSelfW10 ethnocentrismw11 lr_scaleW10_W12 al_scaleW10_W12  

* Model C
svyset [pweight= wt_new_W19_result], psu(id)
svy: logit voteLabW19 c.labLookAfterBAWvWCW19##i.ClassGroup_W19 i.agegrpW19 female i.UKcountryW19 EUIntegrationSelfW19

* Model D
svyset [pweight= wt_new_W13W19], psu(id)
svy: logit voteLabW19 c.labLookAfterBAWvWCW19##i.ClassGroup_W19 i.agegrpW19  female i.UKcountryW19  ethnocentrismw11 EUIntegrationSelfW19

* Model E
svyset [pweight= wt_new_W13W19], psu(id)
svy: logit voteLabW19 c.labLookAfterBAWvWCW19##i.ClassGroup_W19 i.agegrpW19  female i.UKcountryW19 voteLabW13 EUIntegrationSelfW19

* Model F
svyset [pweight= wt_new_W13W19], psu(id)
svy: logit voteLabW19 c.labLookAfterBAWvWCW19##i.ClassGroup_W19 i.agegrpW19  female i.UKcountryW19 voteLabW13 ethnocentrismw11  EUIntegrationSelfW19

 

**************************************

* APPENDIX 18 - The Impact of Evaluations of Labour’s Black and Asian (BME), Middle Class (MC), and Working Class (WC) Representation on Support for Labour -   Sample Restricted to Whites with a Working Class Identity 
	
svyset [pweight= wt_new_W10], psu(id)

* Model A
svy:  logit  voteLabW10 labLookAfterBAW10 labLookAfterMCW10 labLookAfterWCW10 i.agegrpW10 female i.UKcountryW10  if racialclassidentity_W10 == 1 & ethnocentrismw11 !=.& lr_scaleW10_W12 !=. & al_scaleW10_W12 !=.  

* Model B
svy:  logit  voteLabW10 labLookAfterBAW10 labLookAfterMCW10 labLookAfterWCW10 i.agegrpW10  female i.UKcountryW10 ethnocentrismw11 if racialclassidentity_W10 == 1 & lr_scaleW10_W12 !=. & al_scaleW10_W12 !=.

* Model C
svy:  logit  voteLabW10 labLookAfterBAW10 labLookAfterMCW10 labLookAfterWCW10 i.agegrpW10  female i.UKcountryW10 ethnocentrismw11 lr_scaleW10_W12 al_scaleW10_W12 if racialclassidentity_W10 == 1 

									
   
 ***************************************

* APPENDIX 19 - The Impact of Evaluations of Labour’s Relative Representation of Ethnic Minorities and the Working Class on Support for Labour – Sample Restricted to Whites with a Working Class Identity 
 

* Model A
svyset [pweight= wt_new_W10], psu(id)
svy: logit voteLabW10 labLookAfterBAWvWCW10 i.agegrpW10 female i.UKcountryW10 if ethnocentrismw11 !=. &  lr_scaleW10_W12 !=. & al_scaleW10_W12 !=. &  racialclassidentity_W19 == 1 

* Model B
svyset [pweight= wt_new_W10], psu(id)
svy: logit voteLabW10 labLookAfterBAWvWCW10 i.agegrpW10  female i.UKcountryW10 ethnocentrismw11 lr_scaleW10_W12 al_scaleW10_W12   if racialclassidentity_W19 == 1 

* Model C
svyset [pweight= wt_new_W19_result], psu(id)
svy: logit voteLabW19 labLookAfterBAWvWCW19 i.agegrpW19 female i.UKcountryW19   if racialclassidentity_W19 == 1 

* Model D
svyset [pweight= wt_new_W13W19], psu(id)
svy: logit voteLabW19 labLookAfterBAWvWCW19 i.agegrpW19  female i.UKcountryW19  ethnocentrismw11  if racialclassidentity_W19 == 1 

* Model E
svyset [pweight= wt_new_W13W19], psu(id)
svy: logit voteLabW19 labLookAfterBAWvWCW19 i.agegrpW19  female i.UKcountryW19 voteLabW13    if racialclassidentity_W19 == 1 

* Model F
svyset [pweight= wt_new_W13W19], psu(id)
svy: logit voteLabW19 labLookAfterBAWvWCW19 i.agegrpW19  female i.UKcountryW19 voteLabW13 ethnocentrismw11  if racialclassidentity_W19 == 1 


 ***************************************

* APPENDIX 20 - The Impact of Evaluations of Labour’s Black and Asian Representation on Evaluations of Labour’s Working Class Representation - Additional Controls for Trade Union Membership and Religion 
  
svyset [pweight= wt_new_W10], psu(id)	
						
* Model A *		
svy: reg labLookAfterWCW10 c.labLookAfterBAW10##ib1.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10  i.TUmemW2W17 i.religionW10 if ethnocentrismw11 !=.	& lr_scaleW10_W12 !=. & al_scaleW10_W12 !=. & labIDstrengthW10 !=. 

* Model B *		
svy: reg labLookAfterWCW10 c.labLookAfterBAW10##ib1.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10 ethnocentrismw11  i.TUmemW2W17 i.religionW10 if lr_scaleW10_W12 !=. & al_scaleW10_W12 !=. & labIDstrengthW10 !=. 

* Model C *		
svy: reg labLookAfterWCW10 c.labLookAfterBAW10##ib1.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10 ethnocentrismw11 lr_scaleW10_W12 al_scaleW10_W12 i.labIDstrengthW10  i.TUmemW2W17 i.religionW10


*************************************
		
* APPENDIX 21 - The Impact of Evaluations of Labour’s Black and Asian (BME), Middle Class (MC), and Working Class (WC) Representation on Support for Labour - Additional Controls for Trade Union Membership and Religion 
	
svyset [pweight= wt_new_W10], psu(id)

* Model A
svy:  logit  voteLabW10 c.labLookAfterBAW10##ib1.ClassGroup_W10 c.labLookAfterMCW10##ib1.ClassGroup_W10 c.labLookAfterWCW10##ib1.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10  i.TUmemW2W17 i.religionW10 if ethnocentrismw11 !=.& lr_scaleW10_W12 !=. & al_scaleW10_W12 !=.  

* Model B
svy:  logit  voteLabW10 c.labLookAfterBAW10##ib1.ClassGroup_W10 c.labLookAfterMCW10##ib1.ClassGroup_W10 c.labLookAfterWCW10##ib1.ClassGroup_W10 i.agegrpW10  female i.UKcountryW10 ethnocentrismw11  i.TUmemW2W17 i.religionW10 if lr_scaleW10_W12 !=. & al_scaleW10_W12 !=. 

* Model C
svy:  logit  voteLabW10 c.labLookAfterBAW10##ib1.ClassGroup_W10 c.labLookAfterMCW10##ib1.ClassGroup_W10 c.labLookAfterWCW10##ib1.ClassGroup_W10 i.agegrpW10  female i.UKcountryW10 ethnocentrismw11 lr_scaleW10_W12 al_scaleW10_W12  i.TUmemW2W17 i.religionW10

 
 
*************************************
 
* APPENDIX 22 - The Impact of Evaluations of Labour’s Relative Representation of Ethnic Minorities and the Working Class on Support for Labour - Additional Controls for Trade Union Membership and Religion 
 
* Model A
svyset [pweight= wt_new_W10], psu(id)
svy: logit voteLabW10 c.labLookAfterBAWvWCW10##i.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10 i.TUmemW2W17 i.religionW10 if ethnocentrismw11 !=. &  lr_scaleW10_W12 !=. & al_scaleW10_W12 !=. 

* Model B
svyset [pweight= wt_new_W10], psu(id)
svy: logit voteLabW10 c.labLookAfterBAWvWCW10##i.ClassGroup_W10 i.agegrpW10  female i.UKcountryW10 ethnocentrismw11 lr_scaleW10_W12 al_scaleW10_W12  i.TUmemW2W17 i.religionW10

* Model C
svyset [pweight= wt_new_W19_result], psu(id)
svy: logit voteLabW19 c.labLookAfterBAWvWCW19##i.ClassGroup_W19 i.agegrpW19 female i.UKcountryW19 i.TUmemW19W20 i.religionW19

* Model D
svyset [pweight= wt_new_W13W19], psu(id)
svy: logit voteLabW19 c.labLookAfterBAWvWCW19##i.ClassGroup_W19 i.agegrpW19  female i.UKcountryW19  ethnocentrismw11 i.TUmemW19W20 i.religionW19

* Model E
svyset [pweight= wt_new_W13W19], psu(id)
svy: logit voteLabW19 c.labLookAfterBAWvWCW19##i.ClassGroup_W19 i.agegrpW19  female i.UKcountryW19 voteLabW13   i.TUmemW19W20 i.religionW19

* Model F
svyset [pweight= wt_new_W13W19], psu(id)
svy: logit voteLabW19 c.labLookAfterBAWvWCW19##i.ClassGroup_W19 i.agegrpW19  female i.UKcountryW19 voteLabW13 ethnocentrismw11 i.TUmemW19W20 i.religionW19


 *************************************
 
* APPENDIX 23 - Descriptive Statistics - NA
 
 
 *************************************
 
 * APPENDIX 24 - See do-file 2

 *************************************

 * APPENDIX 25 - What Predicts Belief that Labour Represents Black and Asians Better than the Working Class? 

 * Model A (Wave 10) *
svyset [pweight= wt_new_W10], psu(id)
svy: reg labLookAfterBAWvWCW10  ib1.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10  
svy: reg labLookAfterBAWvWCW10  ib1.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10  ethnocentrismw11 lr_scaleW10_W12 al_scaleW10_W12 

* Model B (Wave 19) *
svyset [pweight= wt_new_W19_result], psu(id)
svy: reg labLookAfterBAWvWCW19 ib1.ClassGroup_W19 i.agegrpW19 female i.UKcountryW19  
svy: reg labLookAfterBAWvWCW19 ib1.ClassGroup_W19 i.agegrpW19 female i.UKcountryW19  ethnocentrismw11 
 
* Model C (Wave 21) *
svyset [pweight= wt_new_W21], psu(id)
svy: reg labLookAfterBAWvWCW21 ib1.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10  
svy: reg labLookAfterBAWvWCW21 ib1.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10  al_scaleW21 lr_scaleW21
  
 
 *************************************
 
 * APPENDIX 26 and APPENDIX 27 - The Impact of Evaluations of Labour’s Middle Class Representation on Evaluations of Labour’s Working Class Representation (Table + Figures)
	
svyset [pweight= wt_new_W10], psu(id)

* Model A *		
svy: reg labLookAfterWCW10 c.labLookAfterMCW10##ib1.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10   if ethnocentrismw11 !=.	& lr_scaleW10_W12 !=. & al_scaleW10_W12 !=. & labIDstrengthW10 !=.

margins, at(labLookAfterMCW10=(0(1)3) ClassGroup_W10=(1) agegrpW10=(3) female=(0) UKcountryW10=(1)) atmeans saving(file1, replace) 
margins, at(labLookAfterMCW10=(0(1)3) ClassGroup_W10=(2) agegrpW10=(3) female=(0) UKcountryW10=(1)) atmeans saving(file2, replace) 
margins, at(labLookAfterMCW10=(0(1)3) ClassGroup_W10=(3) agegrpW10=(3) female=(0) UKcountryW10=(1)) atmeans saving(file3, replace) 

combomarginsplot file1 file2 file3, labels("White Working Class" "White Graduates" "Ethnic Minorities") ///
										title("{bf: Model A: Demographic Controls}", size(medsmall) color(black)) ///
										addplot(hist labLookAfterMCW10, ///
                                        blcolor(gs2) fcolor(%20) lc(gs2%10) color(gs2) ///
			                            percent  ///
			                            yaxis(2)   ////
			                            yscale(alt axis(2)) ///
										ytitle("{bf: Distribution of Evaluations of}" "{bf: Labour's Middle Class Representation}", axis(2) size(small) orientation(rvertical)) ///
			                            ylabel(0 "0%" 10 "10%" 20 "20%" 30 "30%" 40 "40%" 50 "50%", ///
		                             	labcolor() axis(2) tlcolor(black) tlwidth(thin) labsize(vsmall) angle(0) nogrid) ///
			                            ytitle("{bf: Predicted Evaluation}" "{bf: of Labour's Working}" "{bf: Class Representation}" `"{bf:(0-3)}"', orientation(horizontal)) ///
										xtitle("{bf: Evaluation of Labour's Middle Class Representation (0-3)}")) ///
										xlabel(0 "0" 1 "1" 2 "2" 3 "3", labsize(small)) ///
										ylabel(1 "1" 1.5 "1.5" 2 "2" 2.5 "2.5", labsize(small) angle(0) nogrid)  ///
                                        graphregion(color(white)) bgcolor(white) ///
										plot1opts(lcolor(red) mcolor(red)) plot2opts(lcolor(midblue) mcolor(midblue)) plot3opts(lcolor(black) mcolor(black)) ///
										ci1opt(recast(rarea) color(red%66) fintensity(50)) ci2opt(recast(rarea) color(midblue%66) fintensity(50)) ci3opt(color(black) fintensity(0))
												
										
* Model B *		
svy: reg labLookAfterWCW10 c.labLookAfterMCW10##ib1.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10 ethnocentrismw11 if lr_scaleW10_W12 !=. & al_scaleW10_W12 !=. & labIDstrengthW10 !=.

margins, at(labLookAfterMCW10=(0(1)3) ClassGroup_W10=(1) agegrpW10=(3) female=(0) UKcountryW10=(1)) atmeans saving(file1, replace) 
margins, at(labLookAfterMCW10=(0(1)3) ClassGroup_W10=(2) agegrpW10=(3) female=(0) UKcountryW10=(1)) atmeans saving(file2, replace) 
margins, at(labLookAfterMCW10=(0(1)3) ClassGroup_W10=(3) agegrpW10=(3) female=(0) UKcountryW10=(1)) atmeans saving(file3, replace) 

combomarginsplot file1 file2 file3, labels("White Working Class" "White Graduates" "Ethnic Minorities") ///
										title("{bf: Model B: + Ethnocentrism Control}", size(medsmall) color(black)) ///
										addplot(hist labLookAfterMCW10, ///
                                        blcolor(gs2) fcolor(%20) lc(gs2%10) color(gs2) ///
			                            percent  ///
			                            yaxis(2)   ////
			                            yscale(alt axis(2)) ///
										ytitle("{bf: Distribution of Evaluations of}" "{bf: Labour's Middle Class Representation}", axis(2) size(small) orientation(rvertical)) ///
			                            ylabel(0 "0%" 10 "10%" 20 "20%" 30 "30%" 40 "40%" 50 "50%", ///
		                             	labcolor() axis(2) tlcolor(black) tlwidth(thin) labsize(vsmall) angle(0) nogrid) ///
			                            ytitle("{bf: Predicted Evaluation}" "{bf: of Labour's Working}" "{bf: Class Representation}" `"{bf:(0-3)}"', orientation(horizontal)) ///
										xtitle("{bf: Evaluation of Labour's Middle Class Representation (0-3)}")) ///
										xlabel(0 "0" 1 "1" 2 "2" 3 "3", labsize(small)) ///
										ylabel(1 "1" 1.5 "1.5" 2 "2" 2.5 "2.5", labsize(small) angle(0) nogrid)  ///
                                        graphregion(color(white)) bgcolor(white) ///
										plot1opts(lcolor(red) mcolor(red)) plot2opts(lcolor(midblue) mcolor(midblue)) plot3opts(lcolor(black) mcolor(black)) ///
										ci1opt(recast(rarea) color(red%66) fintensity(50)) ci2opt(recast(rarea) color(midblue%66) fintensity(50)) ci3opt(color(black) fintensity(0))
										
										
* Model C *		
svy: reg labLookAfterWCW10 c.labLookAfterMCW10##ib1.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10 ethnocentrismw11 lr_scaleW10_W12 al_scaleW10_W12 if labIDstrengthW10 !=.

margins, at(labLookAfterMCW10=(0(1)3) ClassGroup_W10=(1) agegrpW10=(3) female=(0) UKcountryW10=(1)) atmeans saving(file1, replace) 
margins, at(labLookAfterMCW10=(0(1)3) ClassGroup_W10=(2) agegrpW10=(3) female=(0) UKcountryW10=(1)) atmeans saving(file2, replace) 
margins, at(labLookAfterMCW10=(0(1)3) ClassGroup_W10=(3) agegrpW10=(3) female=(0) UKcountryW10=(1)) atmeans saving(file3, replace) 

combomarginsplot file1 file2 file3, labels("White Working Class" "White Graduates" "Ethnic Minorities") ///
										title("{bf: Model C: + Left-Right & Lib-Auth Values Controls}", size(medsmall) color(black)) ///
										addplot(hist labLookAfterMCW10, ///
                                        blcolor(gs2) fcolor(%20) lc(gs2%10) color(gs2) ///
			                            percent  ///
			                            yaxis(2)   ////
			                            yscale(alt axis(2)) ///
										ytitle("{bf: Distribution of Evaluations of}" "{bf: Labour's Middle Class Representation}", axis(2) size(small) orientation(rvertical)) ///
			                            ylabel(0 "0%" 10 "10%" 20 "20%" 30 "30%" 40 "40%" 50 "50%", ///
		                             	labcolor() axis(2) tlcolor(black) tlwidth(thin) labsize(vsmall) angle(0) nogrid) ///
			                            ytitle("{bf: Predicted Evaluation}" "{bf: of Labour's Working}" "{bf: Class Representation}" `"{bf:(0-3)}"', orientation(horizontal)) ///
										xtitle("{bf: Evaluation of Labour's Middle Class Representation (0-3)}")) ///
										xlabel(0 "0" 1 "1" 2 "2" 3 "3", labsize(small)) ///
										ylabel(1 "1" 1.5 "1.5" 2 "2" 2.5 "2.5", labsize(small) angle(0) nogrid)  ///
                                        graphregion(color(white)) bgcolor(white) ///
										plot1opts(lcolor(red) mcolor(red)) plot2opts(lcolor(midblue) mcolor(midblue)) plot3opts(lcolor(black) mcolor(black)) ///
										ci1opt(recast(rarea) color(red%66) fintensity(50)) ci2opt(recast(rarea) color(midblue%66) fintensity(50)) ci3opt(color(black) fintensity(0))
										

* Model D *		
svy: reg labLookAfterWCW10 c.labLookAfterMCW10##ib1.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10 ethnocentrismw11 lr_scaleW10_W12 al_scaleW10_W12 i.labIDstrengthW10 

margins, at(labLookAfterMCW10=(0(1)3) ClassGroup_W10=(1) agegrpW10=(3) female=(0) UKcountryW10=(1) labIDstrengthW10=(0)) atmeans saving(file1, replace) 
margins, at(labLookAfterMCW10=(0(1)3) ClassGroup_W10=(2) agegrpW10=(3) female=(0) UKcountryW10=(1) labIDstrengthW10=(0)) atmeans saving(file2, replace) 
margins, at(labLookAfterMCW10=(0(1)3) ClassGroup_W10=(3) agegrpW10=(3) female=(0) UKcountryW10=(1) labIDstrengthW10=(0)) atmeans saving(file3, replace) 

combomarginsplot file1 file2 file3, labels("White Working Class" "White Graduates" "Ethnic Minorities") ///
										title("{bf: Model D: + Strength Labour Partisanship Control}", size(medsmall) color(black)) ///
										addplot(hist labLookAfterMCW10, ///
                                        blcolor(gs2) fcolor(%20) lc(gs2%10) color(gs2) ///
			                            percent  ///
			                            yaxis(2)   ////
			                            yscale(alt axis(2)) ///
										ytitle("{bf: Distribution of Evaluations of}" "{bf: Labour's Middle Class Representation}", axis(2) size(small) orientation(rvertical)) ///
			                            ylabel(0 "0%" 10 "10%" 20 "20%" 30 "30%" 40 "40%" 50 "50%", ///
		                             	labcolor() axis(2) tlcolor(black) tlwidth(thin) labsize(vsmall) angle(0) nogrid) ///
			                            ytitle("{bf: Predicted Evaluation}" "{bf: of Labour's Working}" "{bf: Class Representation}" `"{bf:(0-3)}"', orientation(horizontal)) ///
										xtitle("{bf: Evaluation of Labour's Middle Class Representation (0-3)}")) ///
										xlabel(0 "0" 1 "1" 2 "2" 3 "3", labsize(small)) ///
										ylabel(1 "1" 1.5 "1.5" 2 "2" 2.5 "2.5", labsize(small) angle(0) nogrid)  ///
                                        graphregion(color(white)) bgcolor(white) ///
										plot1opts(lcolor(red) mcolor(red)) plot2opts(lcolor(midblue) mcolor(midblue)) plot3opts(lcolor(black) mcolor(black)) ///
										ci1opt(recast(rarea) color(red%66) fintensity(50)) ci2opt(recast(rarea) color(midblue%66) fintensity(50)) ci3opt(color(black) fintensity(0))
													

 *************************************
 
 * APPENDIX 28 - The Impact of Evaluations of Labour’s Black and Asian (BME), Middle Class (MC), and Working Class (WC) Representation on Support for Labour,  With Non-Voters Included as Non-Lab Supporters
	
	
svyset [pweight= wt_new_W10], psu(id)

* Model A
svy:  logit  voteLabW10ALT c.labLookAfterBAW10##ib1.ClassGroup_W10 c.labLookAfterMCW10##ib1.ClassGroup_W10 c.labLookAfterWCW10##ib1.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10   if ethnocentrismw11 !=.& lr_scaleW10_W12 !=. & al_scaleW10_W12 !=.  

* Model B
svy:  logit  voteLabW10ALT c.labLookAfterBAW10##ib1.ClassGroup_W10 c.labLookAfterMCW10##ib1.ClassGroup_W10 c.labLookAfterWCW10##ib1.ClassGroup_W10 i.agegrpW10  female i.UKcountryW10 ethnocentrismw11 if lr_scaleW10_W12 !=. & al_scaleW10_W12 !=.

* Model C
svy:  logit  voteLabW10ALT c.labLookAfterBAW10##ib1.ClassGroup_W10 c.labLookAfterMCW10##ib1.ClassGroup_W10 c.labLookAfterWCW10##ib1.ClassGroup_W10 i.agegrpW10  female i.UKcountryW10 ethnocentrismw11 lr_scaleW10_W12 al_scaleW10_W12 
 												
													
 *************************************
 
 * APPENDIX 29 - The Impact of Evaluations of Labour’s Black and Asian (BME), Middle Class (MC), and Working Class (WC) Representation on Support for Labour,  With Subjective Propensity to Vote Labour   (0-10) as an Alternative Dependent Variable 
	
	
svyset [pweight= wt_new_W10], psu(id)

* Model A
svy:  reg ptvLabW10  c.labLookAfterBAW10##ib1.ClassGroup_W10 c.labLookAfterMCW10##ib1.ClassGroup_W10 c.labLookAfterWCW10##ib1.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10 if ethnocentrismw11 !=.& lr_scaleW10_W12 !=. & al_scaleW10_W12 !=.  

* Model B
svy:  reg ptvLabW10  c.labLookAfterBAW10##ib1.ClassGroup_W10 c.labLookAfterMCW10##ib1.ClassGroup_W10 c.labLookAfterWCW10##ib1.ClassGroup_W10 i.agegrpW10  female i.UKcountryW10 ethnocentrismw11 if lr_scaleW10_W12 !=. & al_scaleW10_W12 !=.

* Model C
svy:  reg ptvLabW10  c.labLookAfterBAW10##ib1.ClassGroup_W10 c.labLookAfterMCW10##ib1.ClassGroup_W10 c.labLookAfterWCW10##ib1.ClassGroup_W10 i.agegrpW10  female i.UKcountryW10 ethnocentrismw11 lr_scaleW10_W12 al_scaleW10_W12 
 
 									
 *************************************
 
 * APPENDIX 30 - The Impact of Evaluations of Labour’s Black and Asian (BME), Middle Class (MC), and Working Class (WC) Representation on Support for Labour.  Sample Restricted to ‘Potential Labour Voters’ (PTV Labour > 0/10)  
	
	
svyset [pweight= wt_new_W10], psu(id)

* Model A
svy:  logit  voteLabW10 c.labLookAfterBAW10##ib1.ClassGroup_W10 c.labLookAfterMCW10##ib1.ClassGroup_W10 c.labLookAfterWCW10##ib1.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10  if ethnocentrismw11 !=.& lr_scaleW10_W12 !=. & al_scaleW10_W12 !=.   & inrange(ptvLabW10,1,10)

* Model B
svy:  logit  voteLabW10 c.labLookAfterBAW10##ib1.ClassGroup_W10 c.labLookAfterMCW10##ib1.ClassGroup_W10 c.labLookAfterWCW10##ib1.ClassGroup_W10 i.agegrpW10  female i.UKcountryW10 ethnocentrismw11 if lr_scaleW10_W12 !=. & al_scaleW10_W12 !=. & inrange(ptvLabW10,1,10)

* Model C
svy:  logit  voteLabW10 c.labLookAfterBAW10##ib1.ClassGroup_W10 c.labLookAfterMCW10##ib1.ClassGroup_W10 c.labLookAfterWCW10##ib1.ClassGroup_W10 i.agegrpW10  female i.UKcountryW10 ethnocentrismw11 lr_scaleW10_W12 al_scaleW10_W12 if inrange(ptvLabW10,1,10)

 		
 *************************************
 
 * APPENDIX 31 - The Impact of Evaluations of Labour’s Relative Representation of Ethnic Minorities and the Working Class on Support for Labour – Additional Control for Absolute Ratings of Labour’s Minority and Working Class Representation 
	
 
gen labWCandBME_W10 = labLookAfterBAW10 + labLookAfterWCW10
gen labWCandBME_W19 = labLookAfterBAW19 + labLookAfterWCW19
 
* Model A
svyset [pweight= wt_new_W10], psu(id)
svy: logit voteLabW10 c.labLookAfterBAWvWCW10##i.ClassGroup_W10 labWCandBME_W10 i.agegrpW10 female i.UKcountryW10 if ethnocentrismw11 !=. &  lr_scaleW10_W12 !=. & al_scaleW10_W12 !=. 

* Model B
svyset [pweight= wt_new_W10], psu(id)
svy: logit voteLabW10 c.labLookAfterBAWvWCW10##i.ClassGroup_W10 labWCandBME_W10 i.agegrpW10  female i.UKcountryW10 ethnocentrismw11 lr_scaleW10_W12 al_scaleW10_W12 

* Model C
svyset [pweight= wt_new_W19_result], psu(id)
svy: logit voteLabW19 c.labLookAfterBAWvWCW19##i.ClassGroup_W19 labWCandBME_W19 i.agegrpW19 female i.UKcountryW19 

* Model D
svyset [pweight= wt_new_W13W19], psu(id)
svy: logit voteLabW19 c.labLookAfterBAWvWCW19##i.ClassGroup_W19 labWCandBME_W19 i.agegrpW19  female i.UKcountryW19 ethnocentrismw11

* Model E
svyset [pweight= wt_new_W13W19], psu(id)
svy: logit voteLabW19 c.labLookAfterBAWvWCW19##i.ClassGroup_W19 labWCandBME_W19 i.agegrpW19  female i.UKcountryW19 voteLabW13  

* Model F
svyset [pweight= wt_new_W13W19], psu(id)
svy: logit voteLabW19 c.labLookAfterBAWvWCW19##i.ClassGroup_W19 labWCandBME_W19 i.agegrpW19  female i.UKcountryW19 voteLabW13 ethnocentrismw11


 *************************************
 
 * APPENDIX 32 - The Impact of Evaluations of Labour’s Relative Representation of Ethnic Minorities and the Working Class on Support for Labour, With Non-Voters Included 
	
  
* Model A
svyset [pweight= wt_new_W10], psu(id)
svy: logit voteLabW10ALT c.labLookAfterBAWvWCW10##i.ClassGroup_W10 i.agegrpW10 female i.UKcountryW10 if ethnocentrismw11 !=. &  lr_scaleW10_W12 !=. & al_scaleW10_W12 !=. 

* Model B
svyset [pweight= wt_new_W10], psu(id)
svy: logit voteLabW10ALT c.labLookAfterBAWvWCW10##i.ClassGroup_W10 i.agegrpW10  female i.UKcountryW10 ethnocentrismw11 lr_scaleW10_W12 al_scaleW10_W12  

* Model C
svyset [pweight= wt_new_W19_result], psu(id)
svy: logit voteLabW19ALT c.labLookAfterBAWvWCW19##i.ClassGroup_W19 i.agegrpW19 female i.UKcountryW19 

* Model D
svyset [pweight= wt_new_W13W19], psu(id)
svy: logit voteLabW19ALT c.labLookAfterBAWvWCW19##i.ClassGroup_W19 i.agegrpW19  female i.UKcountryW19  ethnocentrismw11 

* Model E
svyset [pweight= wt_new_W13W19], psu(id)
svy: logit voteLabW19ALT c.labLookAfterBAWvWCW19##i.ClassGroup_W19 i.agegrpW19  female i.UKcountryW19 voteLabW13ALT 

* Model F
svyset [pweight= wt_new_W13W19], psu(id)
svy: logit voteLabW19ALT c.labLookAfterBAWvWCW19##i.ClassGroup_W19 i.agegrpW19  female i.UKcountryW19 voteLabW13ALT ethnocentrismw11  

 
 
  *************************************
 
 * APPENDIX 33 - The Impact of Evaluations of Labour’s Relative Representation of Ethnic Minorities and the Working Class on the Defection of White Working Class Supporters from Labour 2017-19. Sample Restricted to White WC 2017 Labour Voters 
	
 	
 recode voteW19 (2 = 1 "Loyalty to Labour") (1 = 2 "Defect: Cons") (6 = 3 "Defect: UKIP/BP") (3/5 = 4 "Defect: Libs/Greens/Nats") (7 = 4) (9=6 "Defect: Other") (0 = 5 "Defect: Abstain") (else=.), gen(direction_17to19)
 
svyset [pweight= wt_new_W13W19], psu(id)
svy: mlogit direction_17to19 labLookAfterBAWvWCW19 i.agegrpW19 female i.UKcountryW19  if voteLabW13 == 1 & ClassGroup_W19 == 1, base(1) 

svyset [pweight= wt_new_W13W19], psu(id)
svy: mlogit direction_17to19 labLookAfterBAWvWCW19 i.agegrpW19 female i.UKcountryW19 ethnocentrismw11 if voteLabW13 == 1 & ClassGroup_W19 == 1, base(1)

 
 